package vn.sunnet.backviet01.game.coloa.AuLac;

import vn.sunnet.backviet01.game.coloa.interfaces.Human;
import vn.sunnet.backviet01.game.coloa.interfaces.MyGeneral;

public class General implements Human, MyGeneral{
	public static final float INTELLIGENT_DEFAULT = 5.0f;
	public static final String TAG = "general";
	
	protected float totalHP;
	protected int name;

	protected float agility;
	protected float intelligent;
	protected float streng;

	protected float armour;
	protected float attackBasic;

	protected float hitPoints;
	protected float manaPoints;

	protected int level;

	protected float HPps;
	protected float MNps;
	
	protected float mUpUseArrowSkill = 0;
	
	protected float upArrowVelocity = 0;

	private boolean isLife = true;

	public General(int name) {
		this.name = name;
	}
	
	public void setUpUseArrowSkill(final float pUp) {
		mUpUseArrowSkill = pUp;
	}
	
	public float getUpUseArrowSkill() {
		return mUpUseArrowSkill;
	}
	
	public void reduceBlood(float blood) {
		this.hitPoints = hitPoints - blood +  blood * armour * 0.007f;
	}
	
	public void recoverBlood() {
		this.hitPoints += HPps;
	}
	
	public void reducedMana(float mana) {
		this.manaPoints = this.manaPoints - mana;
	}

	public void increaseAttack(float upAttack) {
		this.attackBasic += upAttack;
	}

	public void increaseDefend(float upDefend) {
		this.armour += upDefend;
		
		if (armour > 100) armour = 100;
	}
	
	public void increaseArrowVelocity(float upArrowVelocity) {
		this.upArrowVelocity += upArrowVelocity;
	}
	
	public void increaseStreng(float upStreng) {
		this.hitPoints += upStreng;
	}

	public void increaseIntel(float upIntel) {
		this.manaPoints += upIntel;
	}
	
	public float getUpArrowVelocity() {
		return this.upArrowVelocity;
	}
	
	public void recoverMana() {
		this.manaPoints += MNps;
	}
	
	public float getHPps() {
		return HPps;
	}

	public void setHPps(float hPps) {
		HPps = hPps;
	}

	public float getMNps() {
		return MNps;
	}

	public void setMNps(float mNps) {
		MNps = mNps;
	}

	public float getHP() {
		return hitPoints;
	}

	public void setHP(float totalHP) {
		this.hitPoints = totalHP;
	}

	public int getName() {
		return name;
	}

	public void setName(int name) {
		this.name = name;
	}

	public float getAgility() {
		return agility;
	}

	public void setAgility(float agility) {
		this.agility = agility + AGILITY_DEFAULT;
		this.armour = (int) Math.ceil(this.agility * 0.5f);
		upArrowVelocity = 0;
	}

	public float getIntelligent() {
		return intelligent;
	}

	public void setIntelligent(float intelligent) {
		this.intelligent = intelligent + INTELLIGENT_DEFAULT;
		this.manaPoints = this.intelligent * 10;
		this.MNps = this.intelligent;
	}

	public float getStreng() {
		return streng;
	}

	public void setStreng(float streng) {
		this.streng = streng + STRENG_DEFAULT;
		this.hitPoints = this.streng * 25;
		this.HPps = this.streng / 2;
		this.totalHP = this.hitPoints;
	}

	public float getArmour() {
		if (armour > 100) return 100;
		return armour;
	}

	public void setArmour(float armour) {
		this.armour = armour;
	}

	public float getAttackBasic() {
		return attackBasic;
	}

	@Override
	public void setAttackBasic(float attack) {
		this.attackBasic = attack;
	}

	public float getManaPoints() {
		return manaPoints;
	}

	public void setManaPoints(float manaPoints) {
		this.manaPoints = manaPoints;
	}

	public void useMana(final float useMana) {
		this.manaPoints -= useMana;
	}
	
	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public boolean isLife() {
		return isLife;
	}

	public void setLife(boolean isLife) {
		this.isLife = isLife;
	}

	@Override
	public void resetInformation() {
		// TODO Auto-generated method stub
		
	}

	public void setAttackBasic() {
		
	}
	
}
